// function proxy
function f() {
	return arguments;
}
const functionProxy = new Proxy(f, {
	apply: function (target, ctx, args) {
		console.log(`call function ${target.name} in ${ctx} with ${args}`);
		return Reflect.apply(...arguments);
	}
});
console.log(functionProxy(1, 2, 3));

// constructor proxy
function F(name, age) {
	this.name = name;
	this.age = age;
}
const constructorProxy = new Proxy(F, {
	construct: function (target, args, newTarget) {
		console.log(`create ${newTarget} through ${target.name} with ${args}`);
		return Reflect.construct(target, args, newTarget);
	}
});
const person = new constructorProxy('John', 24);
console.log(person);
